//	@file Version: 1.0
//	@file Name: ADP_F_adpMain.sqf
//	@file Author: THumbert
//	@file Created: 12/14/2013
//	@file Description: Sets up Main Page of ADP

disableSerialization;
_display = findDisplay 6001;
_ctrl = _display displayctrl 1500;
_playerlist = 1500;
_viewDistance = 2100;
_grass = 2101;
_ShadowDistance = 2102;
lbClear _playerlist;
_listunits = AllUnits;
ctrlEnable [2401, false];
ADP_NameCache = [];

for "_idx" from 0 to ((count _listUnits)-1) do {
	_x = _listUnits select _idx;
	_plSide = side _x;
	_name = "";
	_name = name _x;
	ADP_nameCache set [_idx, _x];
    _index = lbAdd [_playerlist, _name];
    lbSetValue [_playerlist, _index, _idx];
	switch(_plSide) do 
		{
		case west : {lbSetColor [_playerlist, _index, [0.012,0.031,0.58,1]];};
		case east : {lbSetColor [_playerlist, _index, [0.569,0,0,1]];};
		case independent : {lbSetColor [_playerlist, _index, [0.004,0.431,0.039,1]];};
		};
};
lbSort _ctrl;

/////////////////////////////////////////////////////////////////////////////////////////////
{
_VD = format ["%1",_x];
_index = lbAdd [_viewDistance, _VD];
lbSetValue [_viewDistance, _index, _x];
} forEach [750, 1600, 2500, 4000, 7000, 14000];
/////////////////////////////////////////////////////////////////////////////////////////////
_index0 = lbAdd [_grass, "None"];
lbSetValue [_grass, _index0, 50];
_index1 = lbAdd [_grass, "Low"];
lbSetValue [_grass, _index1, 25];
_index2 = lbAdd [_grass, "Normal"];
lbSetValue [_grass, _index2, 12.5];
_index3 = lbAdd [_grass, "High"];
lbSetValue [_grass, _index3, 3.125];
/////////////////////////////////////////////////////////////////////////////////////////////
_index4 = lbAdd [_ShadowDistance, "Disabled"];
lbSetValue [_ShadowDistance, 0, 1];
{
_SD = format ["%1",_x];
_index = lbAdd [_ShadowDistance, _SD];
lbSetValue [_ShadowDistance, _index, _x];
} forEach [50, 75, 100, 125, 150, 175, 200];
//////////////////////////////////////////////////////////////////////////////////////////////
_TempMEdit = player getVariable ["MEdit", "false"];
if (typeName _TempMEdit == "Array") then 
	{
		_MEdit = player getVariable ["MEdit", "false"] select 0;
		_MRes = player GetVariable ["MEdit", "false"] select 1;
		if (!(_MEdit == "false")) then {ctrlSetText [1400, _MEdit];};
		if (!(_MRes == "false")) then {ctrlSetText [1405, _MRes];};
	};
call ADP_fnc_addEH
